[Unit]
Description=Prometheus Node Exporter
After=network-online.target

[Service]
Type=simple
User={{ exporter_user }}
Group={{ exporter_group }}
ExecStart={{ software_install_path }}/node_exporter/node_exporter \
{% for collector in node_exporter_enabled_collectors -%}
{%   if not collector is mapping %}
    --collector.{{ collector }} \
{%   else -%}
{%     set name, options = (collector.items()|list)[0] -%}
    --collector.{{ name }} \
{%     for k,v in options|dictsort %}
    --collector.{{ name }}.{{ k }}={{ v | quote }} \
{%     endfor -%}
{%   endif -%}
{% endfor -%}
{% for collector in node_exporter_disabled_collectors %}
    --no-collector.{{ collector }} \
{% endfor %}
{% if exporter_conf | bool %}
    --web.config={{ exporter_conf_path }}/config.yaml \
{% endif %}
    --web.listen-address={{ exporter_web_listen_address }}{% for flag, flag_value in exporter_config_flags_extra.items() %} \
    --{{ flag }}={{ flag_value }}{% endfor %}

SyslogIdentifier=node_exporter
Restart=always
RestartSec=1
StartLimitInterval=0

PrivateTmp=yes
NoNewPrivileges=yes

[Install]
WantedBy=multi-user.target
